﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using Senbo.Model.Entities;

namespace Senbo.Model
{
    public class SenboIntializer : DropCreateDatabaseIfModelChanges<SenboDBContext>
    {
        protected override void Seed(SenboDBContext context)
        {
            List<Category> categorys = new List<Category>() { 
                new Category(){ Guid = Guid.NewGuid(), Name="汪星人", AddTime=DateTime.Now, Publisher= new Publisher (){ PublisherAddress="Address", PublisherName="name"}},
                new Category(){ Guid = Guid.NewGuid(), Name="喵星人", AddTime=DateTime.Now, Publisher= new Publisher (){ PublisherAddress="Address", PublisherName="name"}},
                new Category(){ Guid = Guid.NewGuid(), Name="猪星人", AddTime=DateTime.Now, Publisher= new Publisher (){ PublisherAddress="Address", PublisherName="name"}},
                new Category(){ Guid = Guid.NewGuid(), Name="猴星人", AddTime=DateTime.Now, Publisher= new Publisher (){ PublisherAddress="Address", PublisherName="name"}},
                new Category(){ Guid = Guid.NewGuid(), Name="海星人", AddTime=DateTime.Now, Publisher= new Publisher (){ PublisherAddress="Address", PublisherName="name"}}
            };
            categorys.ForEach(z => context.Categorys.Add(z));
            List<AdminUser> movies = new List<AdminUser>() { 
                new AdminUser(){ Guid =Guid.NewGuid(), Name="2222", AddTime=DateTime.Now, Password="222",PasswordSalt="222",Code="222"},
                new AdminUser(){ Guid =Guid.NewGuid(), Name="3333", AddTime=DateTime.Now, Password="333",PasswordSalt="333",Code="333"}
            };
            //List<Picture> pictures = new List<Picture>() { 
            //    new Picture(){ Guid =Guid.NewGuid() , AddTime =DateTime.Now, Src="", CategoryGuid=categorys[0].Guid},
            //};
            //pictures.ForEach(z => context.Pictures.Add(z));
            context.SaveChanges();
            //base.Seed(context);
        }
    }
}
